<div class="modal-header">
  <button type="button" class="close" data-dismiss="modal" aria-label="关闭"><span aria-hidden="true">&times;</span></button>
  <h4 class="modal-title" id="extension-modal-label">选择顾问</h4>
</div>
<div class="modal-body editor-body-sm">
	<table data-ajax="handlerSearch" 
 				 data-method="post" 
			 	 data-id-field="id" 
			 	 data-unique-id="id" 
				 data-pagination="true" 
				 data-check-on-init="true" 
				 data-click-to-select="true" 
				 data-side-pagination="server" 
				 data-mobile-responsive="true" 
				 data-event-onload="handlerLoaded" 
				 data-form-search="#search-form-consultant" id="table-consultant" class="bootstrap-table">
		<thead>
			<tr>
				<th data-radio="true"></th>
				<th data-field="id" data-visible="false">ID</th>
				<th data-field="name" 		data-align="center" >姓名</th>
				<th data-field="mobile" 	data-align="center" >手机</th>
				<th data-field="newadds" 	data-align="center" >当月新增客户</th>
				<th data-field="follows" 	data-align="center" >当月跟进客户</th>
				<th data-field="members" 	data-align="center" >当月签约客户</th>
			</tr>
		</thead>
	</table>
</div>
<div class="modal-footer">
  <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  <button type="button" class="btn btn-primary" onclick="handlerAdviser()">确认</button>
</div>

<!-- 查询表单 ========================================================= -->
<form id="search-form-consultant" action="/miwawa/{dbname}/common/search.json" method="post" 
			name="com.app.miwawa.api.esm.entity.view.AdviserView">
			<input type="hidden" name="status" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="createDate" data-search-order="desc">
</form>

<script type="text/javascript">
<!--
	// TODO 创建顾问列表
	function createAdviser(trigger){
		var $table = jQuery("#table-consultant");
		if($table.hasClass("table")){
			$table.bootstrapTable("refresh");
		}else{
			$table.bootstrapTable();
		}
	}
	
	// TODO 确认选择顾问
	function handlerAdviser(){
		var rows = jQuery("#table-consultant").bootstrapTable("getSelections");
		if(rows.length == 0){
			jQuery.message.warning("您还未选择顾问！");
		}else{
			jQuery("#table-consultant").bootstrapTable('uncheckAll');
			jQuery('#extension-modal').modal('hide');
			jQuery("#username",".form-editor-customer").val(rows[0].name);
			jQuery("#userid",".form-editor-customer").val(rows[0].id);
		}
	};
//-->
</script>